home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d20 / dorskel2.arc / DOORSKEL.DOC < prev    next >
Text File  |  1991-12-05  |  11KB  |  234 lines

  1. DOORSKEL.LZH Documentation
  2. ==========================
  3.  
  4.  
  5. DOORSKEL is a skeleton for writing your own PC Doors in C.  The source
  6. supports both Turbo C 2.0 and MSC 6.0a.  The Doors you write can read
  7. either DORINFO?.DEF or XBBS' BBS-specific files.  THEY WILL WORK WITH
  8. ANY BBS THAT USES A DORINFO?.DEF FILE AND/OR CAN PASS COMMAND LINE
  9. ARGUMENTS; YOU ARE NOT LIMITED TO USING THESE DOORS WITH XBBS.  THEY
  10. REQUIRE A FOSSIL DRIVER.
  11.  
  12. I'm not going to hold your hand in these docs.  If you don't know how to
  13. program in C, either learn how first or be prepared to do your homework
  14. as you go along.  DOORSKEL is simple to use, but it is in C, not
  15. GWBASIC; a simple book in Greek might be hard for you to read if you
  16. can't read Greek...
  17.  
  18. The first four .C files (DOORSKEL.C, DOORSKL2.C, DOORMISC.C and MTASK.C)
  19. contain support and startup functions.  DOORSKL3.C contains a file
  20. reading function.  DOORSKL4.C contains an empty function (mainloop())
  21. which is where you start writing your own code. The main() function (in
  22. DOORSKEL.C) calls mainloop() after it starts up the Door. By the time
  23. mainloop() executes, the FOSSIL is hot, screen cleared and status line
  24. displayed, command line arguments parsed, info files read and global
  25. variables set up.  You can go to town.  When your program returns from
  26. mainloop(), the FOSSIL is flushed and deinitialized. DOORSKL5.C contains
  27. CRC-16 and CRC-32 code which you can use to implement file transfer
  28. protocols or whatever.  DOORANSI.C contains some fancy ANSI input
  29. routines, and DOORHELP.C contains user help functions.
  30.  
  31. Please take the time to look at the support functions and read the
  32. comments in all files (including particularly DOORSKEL.H) so you don't
  33. reinvent the wheel and see how to take advantage of what you've been
  34. provided.  Most of the commonly asked questions (how do I do xxx when
  35. writing a Door in C?) have been addressed, including disabling
  36. control-break, checking carrier and time, displaying files, inputting
  37. keys and strings, and writing to both the screen (through ANSI.SYS or
  38. equivalent driver) and modem while maintaining a local status line.
  39.  
  40. The SCREEN2.ASM/OBJ files in the archive were lifted from jim nutt's
  41. MSGED 2.0 source code (it's marked "public domain" within an inch of its
  42. life).  Thanks to jim (I assume he wrote it).  Turbo C's cprintf()
  43. contains a big bug (won't write to lines below 25 in 43/50/60 line
  44. mode), so this made it much easier.  The OBJ is compiled in large model,
  45. but you'll note the prototypes in doorskel.h that allow you to use it
  46. (carefully) in small models.  There's also ANSI.ASM/OBJ files in the
  47. archive that came from the RBBS source and were heavily modified.
  48.  
  49. Although you can consider most of this code a "black box," you might
  50. want to wedge some command line arguments into main() or add something
  51. to the deinit() code executed when the program exit()s.  I've tried to
  52. leave you comments about what each function does.  Hopefully the
  53. #defines to get the code to work with either Turbo C or MSC won't get
  54. too much in the way of your understanding.  I provided complete source
  55. instead of some sort of library so that anything you don't like can be
  56. adjusted.  But, please, for your own sake, make changes slowly, if at
  57. all, to the existing code, and only after trying it out as is first!
  58. You'll save yourself some headaches...
  59.  
  60. If you need to ask a question, send me netmail.  Poll again in a few
  61. days for a reply.
  62.  
  63. Keep in mind what you paid for DOORSKEL before you write me just to
  64. bitch.  On the other hand, constructive criticism, suggestions and
  65. wish-lists are welcome.
  66.  
  67.  
  68. The Doorskel archive contains SAMPLE.C, which can be used to create the
  69. sample Door SAMPLE.EXE (also included, compiled with TC 2.0).  SAMPLE.C
  70. is DOORSKL4.C with mainloop() (the function where your coding starts)
  71. filled in.  This is provided as a simple example of how to use the kit
  72. to create a running .EXE, and so you can quickly satisfy yourself that
  73. the code works.  SAMPLE H for help on how to use it.
  74.  
  75.  
  76. I've also added XBBSMSG.LZH to the archive.  This can let you write code
  77. that interfaces directly and safely with the XBBS message bases if you've
  78. got the urge.
  79.  
  80.  
  81. Most commonly used functions:   (see prototypes in doorskel.h)
  82. ============================
  83.  
  84. hitreturn:      display "Press [Enter] to continue: " and wait for
  85.                 [Enter] to be pressed
  86. cls:            clear local and remote screens
  87. debug_print:    display messages locally only, and then only if debug
  88.                 mode is turned on at the command line with "!".  Handy
  89.                 for testing.
  90. addtolog:       write a string to a logfile (default is XBBS.LOG set in
  91.                 DOORSKEL.C)
  92. inkey:          mimics BASIC's INKEY$ function; basic method of getting
  93.                 a character from the user.  returns 0 if no char
  94.                 available.  handles special keys (like ALT-+ for more
  95.                 time, ALT-H to hang up, etc. from local, ANSI cursor and
  96.                 Doorway keys from remote)
  97. genin:          generic input routine.  very versatile.
  98. printfm:        printf-clone for both local and remote.
  99. spawnit:        spawn a program.  Handles clearing screen before spawn
  100.                 and clearing screen and restoring status line after.
  101. mainloop:       where your coding really starts, in DOORSKL4.C
  102. printm:         print a string to local and remote; no formatting like
  103.                 printfm.
  104. printg:         like printm but only sends string if user has ANSI
  105.                 graphics on.
  106. mprint:         print a string to remote only, no formatting.
  107. deinitialize:   exit routine established in DOORSKEL.C via atexit().
  108.                 disables FOSSIL, closes all files, etc.  You can add
  109.                 things to this (it's in DOORSKEL.C).
  110. ansi:           print a string locally only; protects status line.  No
  111.                 formatting.  this function is in ANSI.ASM (compiled in
  112.                 large mode in provided ANSI.OBJ; see prototypes in
  113.                 doorskel.h).
  114. readtext:       super-duper file reader for remote users.  try it,
  115.                 you'll like it.  It's in DOORSKL3.C and does everything
  116.                 but make coffee in the morning.
  117. dputc:          direct screen putc
  118. dputs:          direct screen puts (no cr/lf terminator added)
  119. dprintf:        direct screen printf
  120. fossil:         handles most common FOSSIL int 14H calls.  see also
  121.                 macros defined in doorskel.h for convenience.
  122.  
  123. Global variables of interest:  (already set when mainloop() executes)
  124. ============================
  125.  
  126. maxx, maxy:     width and length of the local screen.
  127. current_color:  used by direct screen writing functions as color for
  128.                 text.
  129. debug_mode:     if non-zero, debug_print will display text locally.
  130. graphics:       non-zero if user has ANSI graphics capability on.
  131. timelimit:      user's time tracking variable.  use macro MinsLeft
  132.                 (defined in doorskel.h) to get something easier to work
  133.                 with, or check getxbbstime() to see how it's used.
  134. baud:           0 if local, otherwise baud rate of user
  135. numlines:       length of user's screen
  136. width:          width of user's screen
  137. seclvl:         security level of user
  138. commport:       port program is communicating with if baud > 0; 0-based
  139.                 so that 0 = COM1 (the way FOSSILs like it)
  140. logfile:        name of logfile to which addtolog will write.
  141. username:       name of user.
  142. nodenumber:     node of caller (for multiline systems).
  143.  
  144. (#defining XBBS causes some other interesting variables to be created)
  145.  
  146.  
  147. (Note:  I'll add to this list and the descriptions as I get time)
  148.  
  149.  
  150.  
  151. Special local keys supported by DOORSKEL:
  152.  
  153. ALT-H:  hang up, end program
  154. ALT-J:  jump to local DOS shell
  155. ALT-+:  increase time by 1 minute
  156. ALT--:  decrease time by 1 minute
  157. ALT-C:  enter/exit chat mode
  158. CTRL-C: if DISABLEBREAK isn't defined, works as expected
  159. CTRL-ALT-DEL: guess
  160.  
  161.  
  162. Doorskel reads ANSI escape sequences from the remote for cursor
  163. movement, and processes "Doorway" keys.  Take a look at specialmod() in
  164. doorskel.c to see how it works.
  165.  
  166.  
  167. This code does produce warnings; it's not completely "clean".  As far as
  168. I can tell, it works fine.  It's been cobbled together from doors and
  169. BBSes I've written, as an explanation for its slovenliness.  And
  170. remember, I'm a self-taught ex-BASIC programmer who just does this as a
  171. hobby.  If someone wants to clean up all the warnings and send me the
  172. code, more power to them; I'd appreciate it.  Just don't let the
  173. warnings scare you.
  174.  
  175.  
  176. Log of changes:
  177. ==============
  178.  
  179. /* 10/24/91 */
  180.  
  181. Moved some functions from DOORSKEL.C to DOORMISC.C; not sure why, but I
  182. did.  Include DOORMISC.C in any project where you include DOORSKEL.C
  183. (read: all projects).
  184.  
  185. Added MTASK.C (routines in DOORSKEL.C call what's needed, so don't worry
  186. about it, just include it in your project) to allow DOORSKEL doors to
  187. get along with multitaskers (give up time slices).  SAMPLE.EXE in the
  188. archive is still the one compiled with the old package (just too lazy to
  189. recompile).  If you're curious but lazy (aren't we all?), reference to
  190. set_mtask() is in main() and references to pause_mtask() are in inkey()
  191. and my_sleep().
  192.  
  193. /* 10/27/91 */
  194.  
  195. Added DOORHELP.C and DOORANSI.C containing functions lifted from XDB's
  196. source code.  I haven't attempted to compile these as part of a Doorskel
  197. project, so you might have to tweak here and there.  They provide help
  198. facilities and fancy-ANSI menus.
  199.  
  200. /* 12/01/91 */
  201.  
  202. Did some work, testing, clarification, etc. to make Doorskel smaller and
  203. somewhat easier to read and use.  Pay particular attention to the
  204. comments in DOORSKEL.H (now arranged in blocks so you can find the part
  205. you're interested in more easily) and at the top of each module.
  206. Recompiled SAMPLE.EXE with MSC this time (in small model, just to make
  207. sure it could be done, with no optimizations). Included MSC 6.0
  208. SAMPLE.MAK and TC 2.01 SAMPLE.PRJ files so you can reconstruct
  209. SAMPLE.EXE for testing.  If you have a compiler other than TC 2.01 or
  210. MSC 6.0x, hopefully the portability stuff I've already put in will make
  211. it fairly easy to modify the code to work with your compiler.  By all
  212. means, send me what it took to get it to work to incorporate into future
  213. releases.
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220. Except where specifically noted in the source,
  221.  
  222.   DOORSKEL is copyright (c) 1990/91 by M. Kimes, All Rights Reserved.
  223.  
  224. It may be freely used for >>>FREE<<< programs as long as you don't try
  225. to save any souls (nasty habit).  If you want to make money on a program
  226. you write with it, give me a call and we'll work something reasonable
  227. out.  If you want to save souls with a program you write with it,
  228. go directly to hell.
  229.  
  230.  
  231. M. Kimes
  232. 1:380/16.0@Fidonet
  233. (318)222-3455 data
  234.